-- https://github.com/nvim-lualine/lualine.nvim

local conf = require("conf")

local pack = {}

pack.lazy = {
    "nvim-lualine/lualine.nvim",
    -- 移除nvim-web-devicons依赖，避免加载图标插件
    dependencies = {},
    event = { "UIEnter" },
}

function pack.before_load()
    pack.plugin = require("lualine")
end

function pack.load()
    local sections = {
        lualine_a = { "mode" },
        lualine_b = { "branch", "diff", "diagnostics" },
        lualine_c = { "filename" },
        lualine_x = {
            { "encoding", icons_enabled = false },
            { "fileformat", icons_enabled = false },
            {
                function()
                    -- 为所有文件类型设置统一的中圆点图标
                    -- 这个方法适用于所有文件类型，避免特定文件类型图标显示问题
                    -- 如需为特定文件类型设置不同图标，可以在这里添加判断逻辑
                    return "• " .. vim.bo.filetype
                end,
                padding = { left = 1, right = 1 },
            }
        },
        lualine_y = { "progress" },
        lualine_z = { "location" },
    }

    pack.plugin.setup({
        options = {
            theme = conf.get_colorscheme(),
            icons_enabled = false, -- 完全禁用图标功能，避免nvim-web-devicons的影响
            disabled_filetypes = {},
            globalstatus = true,
            refresh = {
                statusline = 1000,
                tabline = 100,
                winbar = 100,
            },
        },
        sections = sections,
    })
end

function pack.after_load() end

return pack
